home *** CD-ROM | disk | FTP | other *** search
- /* RCSid[]="@(#)$Header: make.cpl,v 3.4 87/10/13 18:21:48 pb Exp $" */
- /* */
- /* procedure to build the Cambridge nrs database processor */
- /* */
- /* option list: */
- /* */
- /* operations: (default is to make everything that it needs to) */
- /* compile: Force compilation of the sources */
- /* link: Force link of the binaries */
- /* install: Install the executable in the target dir */
- /* build: == -compile -link -install -report */
- /* getfiles: Fetch the DERFIL2 from salford */
- /* convert: Convert DERFIL2 into a usable format */
- /* generate: Generate the T.CENTRAL file */
- /* */
- /* general flags: */
- /* report: If set reports on the progress of the make */
- /* */
- /* specific flags: */
- /* debug: If set builds a version which interfaces with the */
- /* source level debugger */
- /* debugcpl: enables CPL debugging */
- /* nocomo: If set does not record the progress of the build */
- /* in a command output file */
- /* */
- /* All remaining arguments are taken as compiler options. */
- /* */
-
- &args unclaimed:uncl; compile:-compile,-c comfile:entry; link:-link,-l; ~
- install:-install,-i; getfiles:-get,-gf; convert:-convert,-cv; ~
- generate:-generate,-g; debug:-debug,-d; report:-report,-rpt; ~
- nocomo:-no_como,-nco; build:-build,-bld,-b; debugcpl:-debugcpl;
-
- &if ^ [null %debugcpl%] &then~
- &debug &echo all &watch
-
- &s name := NRSGEN /* name of executable */
- &s decompress := DECOMPRESS /* and the FULL NAME of decompress program */
- &s version := NRS3.3 /* version number of executable */
- &s nift := TRUE /* define if NIFT is available */
- &s serc := TRUE /* define if SERC FTP is available */
- &s isocept := FALSE /* define if ISOCEPT is available */
- &s localuser := NSUM52 /* used by serc and isocept to get DERFIL2 */
- &s localpw := PLEB /* used by serc and nift to get DERFIL2 */
- &s nrsuser := NRSUSERS /* used to get DERFIL2 */
- &s nrspw := NRS /* used to get DERFIL2 */
- &s thissite := UMPA /* used by isocept to get DERFIL2 */
-
- /* base file names */
-
- &s base := *> /* the development directory */
- &s instdir := NAMESERVER*>TOOLS>/* installation directory */
- &s ddir := NAMESERVER*>NRS> /* database directory */
-
- /* these should be standard */
-
- &s source := %base% /* source directory */
- &s include := %base% /* insert file directory */
- &s bin := %base% /* object directory */
- &s cfs := %base% /* cf source directory */
- &s central := %base%T.CENTRAL /* location of output file */
- &s config := %ddir%CENTRAL.CF /* location of config file */
- &s derfil := %ddir%DERFIL2 /* the DERFIL2 */
- &s rawderfil := %derfil%.RAW /* the raw (compressed) DERFIL2 */
- &s nrsaddr := NRS /* used to get DERFIL2 */
- &s nrsdir := MAKE.NRS>DATABASE> /* used to get DERFIL2 */
-
- /* shouldn't need to be tailored */
-
- &s cflags := -sof -include %include% %debug% -define VERSION "%version%" ~
- %unclaimed% /* compiler flags */
- &s defmodules := defs main config lru misc output /* modules to compile */
-
- /* set up subnetwork context pairs */
-
- &s network := X29.JANET ~
- X29.PSS ~
- TS29.JANET ~
- TS29.PSS ~
- FTP.JANET ~
- FTP.PSS ~
- MAIL-NIFTP.JANET ~
- MAIL-NIFTP.PSS ~
- MAIL-X29.JANET ~
- MAIL-X29.PSS ~
- MAIL-TELEX.TELEX ~
- JTMP.JANET ~
- JTMP.PSS ~
- JTMP-FILES.JANET ~
- JTMP-FILES.PSS ~
- JTMP-REG.JANET ~
- JTMP-REG.PSS ~
- YBTS.JANET ~
- YBTS.PSS ~
- YBTS-NODE.JANET ~
- YBTS-NODE.PSS
-
- /* no options --> do everything en route */
-
- &s noargs := [null %compile%%link%%install%%getfiles%%convert%%generate%%build%]
-
- /* shorthand */
-
- &if ^ [null %build%] &then &do
- &s compile := -
- &s link := -
- &s install := -
- &end
-
- /* decode general switches */
-
- &if [null %debug%] ~
- &then &s suff :=
- &else &s suff := .DBG
-
- &if [null %nocomo%] ~
- &then como %name%.BUILD.COMO
-
- /* are any binaries out of date? -- if so, recompile */
-
- &if %noargs% &then &do
-
- /* Set up %latest% to be the runanable binary to compare */
- /* datestamps with, in case there is no bin file */
- /* Use local in preference to installed version */
- &if [exists %bin%%name%.run] ~
- &then &s latest := %bin%%name%.run
- &else &if [exists %instdir%%name%.run] ~
- &then &s latest := %instdir%%name%.run
- &else &s latest :=
-
- &if ^ [exists %include%nrs.h] &then &do
-
- type %include%nrs.h does not exit.
- type please do something about this
-
- como -e -tty
- &return
- &end
-
- &do module &list %defmodules%
-
- &if ^ [exists %source%%module%.cc] &then &do
-
- type %source%%module%.cc does not exit.
- type please do something about this
-
- como -e -tty
- &return
- &end
-
- &if ^ [exists %bin%%module%%suff%.bin] ~
- &then &if [null %latest%] ~
- &then &s addthis := 1
- &else &if [attrib %source%%module%.cc -dtm] ~
- > [attrib %latest% -dtm] ~
- | [attrib %include%nrs.h -dtm] ~
- > [attrib %latest% -dtm] ~
- &then &s addthis := 2
- &else &s addthis :=
- &else &if [attrib %source%%module%.cc -dtm] ~
- > [attrib %bin%%module%%suff%.bin -dtm] ~
- | [attrib %include%nrs.h -dtm] ~
- > [attrib %latest% -dtm] ~
- &then &s addthis := 3
- &else &s addthis :=
-
- &if ^ [null %addthis%] ~
- &then &do
- &s compile := -
- type %module% by %addthis%
- &if [exists %bin%%module%%suff%.bin] ~
- &then &if [null %comfile%] ~
- &then &s comfile := %module%
- &else &s comfile := %comfile% %module%
-
- &end
- &end
-
- /* OK -- if ANY binary need compiling, also compile missing ones */
- &if ^ [null %compile%] &then ~
- &do module &list %defmodules%
- &if ^ [exists %bin%%module%%suff%.bin] ~
- &then &s comfile := %comfile% %module%
- &end
-
- &end
-
- &if ^ [null %compile%] &then &do
- &if [null %comfile%] ~
- &then &s modules := %defmodules%
- &else &s modules := %comfile%
-
- type Compiling %modules% for version %version% of %name%...
-
- &do module &list %modules%
- &if ^ [null %report%] ~
- &then type Compiling %module%
- cc %source%%module% %cflags% -b %bin%%module%%suff%.bin
- &end
- &end
-
-
- /* is the .run out of date? -- if so, relink */
-
- &if %noargs% &then &do
- &if [null %latest%] ~
- &then &s link := -
- &else &do module &list %defmodules%
- &if [exists %bin%%module%%suff%.bin] ~
- &then &if [attrib %bin%%module%%suff%.bin -dtm] ~
- > [attrib %latest% -dtm]~
- &then &s link := -
- &end
- &end
-
- &if ^ [null %link%] &then &do
-
- type Linking version %version% of %bin%%name%...
-
- &data bind %bin%%name%
- version [quote %name% rev %version%]
- li ccmain
- &do module &list %defmodules%
- lo %bin%%module%%suff%
- &end
- li c_lib
- li
- ma -un
- file
- &end
- &end
-
- /* deal with installation -- do not overwrite by default! */
-
- &if %noargs% &then &do
- &if ^ [exists %instdir%%name%.run] ~
- &then &s install := -
- &else &if [exists %bin%%name%.run] ~
- &then &if [attrib %bin%%name%.run -dtm] ~
- > [attrib %instdir%%name%.run -dtm] ~
- &then &do
-
- type The installed version of %name% is out of date.
- type To install the new copy type the command: r make -install
- type To make a new t.central anyway type : r make -generate
-
- como -e -tty
- &return
- &end
- &end
-
- &if ^ [null %install%] ~
- &then copy %bin%%name%.run %instdir%== -dl -nq -nvfy -rpt
-
- &if [null %nocomo%] ~
- &then como -e
-
- /* is the DERFIL2.RAW available? -- if not, fetch it */
-
- &if %noargs% &then &do
- &if ^ [exists %rawderfil%] ~
- &then &s getfiles := -
- &end
-
- /* fetch the file from salford */
-
- &if ^ [null %getfiles%] &then &do
-
- &select TRUE
-
- &when %nift%
- nift %nrsdir%DERFIL2 ~
- %rawderfil% -fr %nrsaddr% -ru %nrsuser% %nrspw% -t -lp %localpw%
-
- &when %serc%
- &data FTP
- SITE %nrsaddr%
- RTREE %nrsdir%
- LTREE %rawderfil%
- REMOTE %nrsuser% %nrspw%
- LOCAL %localuser% %localpw%
- FETCH DERFIL2 (NOBIN)
- QUIT
- &end
-
- &when %isocept%
- &data ISOCEPT
- FTP
- %nrsdir%DERFIL2 AT %nrsaddr% TO %rawderfil% AT %thissite%
- %nrsuser%
- %nrspw%
- TEXT
- YES
- I-HAVE-NO-REFERENCE
- &end
- &end
-
- &if %noargs% &then~
- &stop 1 &message ~
- You must wait for the file to be transfered before converting it
-
- &end
-
- /* is the DERFIL2 out of date? -- if so, convert */
-
- &if %noargs% &then &do
- &if [attrib %rawderfil% -dtm] > [attrib %derfil% -dtm]~
- &then &s convert := -
- &end
-
- /* convert the file to a useable format */
-
- &if ^ [null %convert%] ~
- &then %decompress% %rawderfil% %derfil%
-
- &if %noargs% &then &do
-
- &if ^ [exists %derfil%] &then &do
- type %derfil% can't be found.
- type Please do something about it
-
- como -e -tty
- &return
- &end
-
- &if ^ [exists %central%] ~
- &then &s generate := -
- &else &if [attrib %derfil% -dtm] > [attrib %central% -dtm]~
- &then &s generate := -
- &else type %central% is up to date
- &end
-
- &if ^ [null %generate%] &then &do
-
- type making %central%
-
- como %central%.tmp -ntty
-
- type .nf
- type .H1 Forward Lookup
- type
-
- &do netname &list %network%
- &s net := [before %netname% '.']
- &s subnet := [after %netname% '.']
- type .H1 Context %net% Subnetwork %subnet%
- type
- r %instdir%%name% %config% [quote context %net% %subnet%]
- &end
-
- type
- type .H1 Reverse lookup
- type
-
- &do netname &list %network%
- &s net := [before %netname% .]
- &s subnet := [after %netname% .]
- type .H1 Context %net% Subnetwork %subnet%
- type
- r %instdir%%name% %config% [quote context %net% %subnet%] 'output reverse text'
- &end
-
- como -e -tty
-
- cname %central%.tmp %central%
-
- &end
-
- como -e -tty
- &return
-